// pages/main/index.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    mainItems: [],

  },
  toLearning0() {
    if (!this.pageLoading) {
      this.pageLoading = !0;
      wx.navigateTo({
        url: "/pages/getData/input/input?studentNum=" + JSON.stringify(this.data.mainItems[0].count)
      });
    }
  },
  toLearning1() {
    if (!this.pageLoading) {
      this.pageLoading = !0;
      wx.navigateTo({
        url: "/pages/getData/notice/notice?studentNum=" + JSON.stringify(this.data.mainItems[1].noticeId)
      });
    }
  },
  toLearning2() {
    if (!this.pageLoading) {
      this.pageLoading = !0;
      wx.navigateTo({
        url: "/pages/getData/teacher/teacher?noticeId=" + JSON.stringify(this.data.mainItems[2].noticeId)
      });
    }
  },
  onShow() {
    this.pageLoading = !1;
    this.getMainItem();
  },
  getMainItem() {
    let that = this;
    wx.request({
      url: app.buildUrl("/notice/list"),
      header: app.getRequestHeader(),
      success: res => {
        var resp = res.data;
        if (resp.code != 200) {
          app.alert({
            "content": resp.msg
          });
          return;
        }
        that.setData({
          mainItems: resp.data
        })
      }
    })
  }
})